<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .b1 {
            width: 100px;
            height: 100px;
            background-color: #bfa;
        }
        .b2 {
            height: 200px;
            background-color: pink;
        }
    </style>
    <script src="tools.js"></script>
    <script>

        window.onload = function(){
            let btn1 = document.getElementById("btn1");
            let box1 = document.getElementById("box1");

            btn1.onclick = function(){
                // addClass(box1, "b2");
                // removeClass(box1, "b2");
                toggleClass(box1, "b2");
            }
        }
    </script>
</head>
<body>
    <button id="btn1">点击变样</button>
    <div class="b1" id="box1"></div>
</body>
</html>